<template>
  <view class="container">
    <view class="header">
      <view style="display: flex; justify-content: space-evenly; align-items: center; height: 75rpx; line-height: 75rpx">
        <view :class="{ common: true, act: index == 1 }" @click="index = 1">上课预约</view>
        <view :class="{ common: true, act: index == 2 }" @click="index = 2">取消上课预约</view>
      </view>
    </view>
    <!-- 预约列表 -->
    <view class="list" v-if="index == 1">
      <view class="item" v-for="index in 5" :key="index" @click="goyuyuedetail">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>

          <view style="display: flex; align-items: center; margin-top: 12rpx">
            <view class="subject">初三 | 数学</view>
            <view class="des">首次预约</view>
          </view>
          <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222; margin-top: 40rpx">周三共3课时</view>
        </view>
      </view>
    </view>
    <!-- 取消预约列表 -->
    <view class="list" v-if="index == 2">
      <view class="item" v-for="index in 5" :key="index" @click="gocancleyuyuedetail">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject" style="margin-top: 16rpx">初三 | 数学</view>
          <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222; margin-top: 40rpx">取消3课时</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      index: 1
    };
  },
  methods: {
    // 跳转预约详情
    goyuyuedetail() {
      uni.navigateTo({
        url: '/sub_yuyue/yuyuedetail/yuyuedetail'
      });
    },
    // 跳转取消预约详情
    gocancleyuyuedetail() {
      uni.navigateTo({
        url: '/sub_yuyue/cancleyuyuedetail/cancleyuyuedetail'
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  .header {
    width: 750rpx;
    height: 100rpx;

    background: #3553e8;
    .common {
      font-size: 26rpx;
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      color: #ffffff;
    }
    .act {
      font-size: 28rpx;
      border-bottom: 6rpx solid #fff;
    }
  }
  .list {
    box-sizing: border-box;
    margin: 30rpx;
    .item {
      display: flex;
      width: 690rpx;
      height: 186rpx;
      margin-bottom: 40rpx;
      .right {
        flex: 1;
        margin-left: 20rpx;
        .name {
          display: flex;
          .school {
            font-size: 22rpx;
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            width: 172rpx;
            height: 40rpx;
            background: #eaedfd;
            border-radius: 10rpx 10rpx 10rpx 10rpx;
            color: #3553e8;
            text-align: center;
            line-height: 40rpx;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
          }
        }
        .subject {
          font-size: 26rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
        }
        .des {
          box-sizing: border-box;
          height: 40rpx;
          padding: 0rpx 14rpx;
          margin-left: 16rpx;
          text-align: center;
          line-height: 40rpx;
          font-size: 22rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          color: #3553e8;
          background: #ffffff;
          border-radius: 10rpx 10rpx 10rpx 10rpx;
          border: 1rpx solid #3553e8;
        }
      }
    }
  }
}
</style>
